package com.xy.hms.mapper;


import com.xy.hms.model.User;
import com.xy.hms.model.UserRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;


import java.util.List;

/**
 * @author xiaye
 * @create 2020-02-26-16:16
 */

@Mapper
@Repository   //表明这是一个dao层
public interface UserMapper {

    //根据User查看操作用户
    User selectByUser(User user);


    User selectUserByName(String name);

    //查看用户id对应的权限字符串
    List<String> getPermissions(Integer uid);

    String getRoleName(User toConfirmUser);

    int addUser(@Param("username") String username, @Param("password") String password);

    //查找所有带角色权限的用户
    List<User> selectAllUserWithPermission();

    //依据id查询用户
    User selectAllUserWithPermissionById(Integer id);

    int updateUser(User user);

    int updateUserRole(@Param("uid")Integer uid,@Param("rid")Integer rid);

    int addUserRole(Integer id);
}
